// localStorage, 把所有 key 集中到这里来
const storage = new class Storage {

  api_token ='api_token'

  get (key) {
    return localStorage.getItem(key)
  }

  set (key, value) {
    return localStorage.setItem(key, value)
  }

  remove (key) {
    return localStorage.removeItem(key)
  }

  clear () {
    for (const prop in this) {
      if (this.hasOwnProperty(prop)) {
        localStorage.removeItem(prop)
      }
    }
  }
}

// TODO: debug 专用
window.$$storage = storage

export default storage
